package com.xlongwei.accounts.model;

import java.time.LocalDate;

import org.noear.snack.annotation.ONodeAttr;

import lombok.Data;

@Data
public class Record {
    private Integer recordid;
    @ONodeAttr(format = "yyyy-MM-dd")
    private LocalDate day;
    private Integer amount;
    private Integer ledgerid = 0;
    @ONodeAttr(name = "accountid_in")
    private Integer accountidIn = 0;
    @ONodeAttr(name = "accountid_out")
    private Integer accountidOut = 0;
    private Integer memberid = 1;
    private Integer userid;
    private String remark;

    public boolean isIncome() {
        return accountidIn > 0 && accountidOut <= 0;
    }

    public boolean isOutcome() {
        return accountidIn <= 0 && accountidOut > 0;
    }

    public boolean isTransfer() {
        return accountidIn > 0 && accountidOut > 0;
    }

    /**
     * 不计收支？
     */
    public boolean isOthers() {
        return accountidIn <= 0 && accountidOut <= 0;
    }
}
